package leader

import (
	"errors"
	"net/http"
)

func healthz(_ *http.Request) error {
	if initMgr.DoesTemplatesExist() && templateR != nil && !templateR.HealthCheck() {
		return errors.New("TemplateController is not initialized")
	}
	if initMgr.DoesTriggersExist() && triggerR != nil && !triggerR.HealthCheck() {
		return errors.New("TriggerController is not initialized")
	}
	if initMgr.DoesScopesExist() && scopeR != nil && !scopeR.HealthCheck() {
		return errors.New("ScopeController is not initialized")
	}
	return nil
}

func readyz(_ *http.Request) error {
	return nil
}
